package com.dgz.test.controller;

import org.springframework.ai.chat.client.ChatClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: DongGuoZhen
 * @Date: 2025/07/21/16:37
 * @Description:
 */
@RestController
@RequestMapping("/chat")
public class ChatController {


    private ChatClient client;
// 给ai立人设
    public ChatController(ChatClient.Builder client) {
        this.client = client.
                defaultSystem("你是一个演员，请列出你所参演的所有电影")
                .build();
    }

    @RequestMapping("test1")
    public String test1(String input) {
        return client.prompt().user(input).call().content();
    }
}
